<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt_rt" %>

<html>
<head>
    <title>登录页</title>
    <%--echart线图、柱状图、饼图等各种图型库 cdn--%>
    <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts/dist/echarts.min.js"></script>
    <%--jquery cdn--%>
    <script type="text/javascript" src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.1/jquery.js"></script>
</head>
<body>

<form action="/list.do">

    学生名<input name="studentName" value="${query.studentName}"><br>
    宿舍名<input name="roomName"  value="${query.roomName}"><br>
    宿舍楼名<input name="apartmentName"  value="${query.apartmentName}"><br>
    <input type="submit" value="查询">
    <input type="button" value="导出列表数据" onclick="excelList()">
    <a href="/addPage.do">添加</a>

    <table>
        <tr>
            <td>宿舍</td>
            <td>图片</td>
            <td>楼号</td>
            <td>学生</td>
            <td>入住时间</td>
        </tr>
        <c:forEach items="${pageInfo.list}" var="s">
            <tr>
                <td>${s.roomName}</td>
                <td> <img  style="height: 50px;width: 50px" src="${s.pic}"></td>
                <td>${s.apartmentName}</td>
                <td>${s.studentName}</td>
                <td>${s.createTime}</td>
            </tr>



        </c:forEach>

        <tr>
            <td>
                <button name="pageNum" value="1">首页</button>
                <button name="pageNum" value="${pageInfo.prePage}">上页</button>
                <button name="pageNum" value="${pageInfo.nextPage}">下页</button>
                <button name="pageNum" value="${pageInfo.pages}">尾页</button>
            </td>
        </tr>
     </table>

</form>

</body>
<script>

    function excelList() {

        let studentName = $('[name=studentName]').val();
        let roomName = $('[name=roomName]').val();
        let apartmentName = $('[name=apartmentName]').val();
        location.href = "/excelList.do?studentName=" + studentName + '&roomName=' + roomName +'&apartmentName=' + apartmentName

    }
</script>
</html>